import { contextBridge, ipcRenderer } from "electron";
// const addon = require("./addon");
// import addon from "./addon-bridge.mjs";

contextBridge.exposeInMainWorld("electron", {
  send: (channel, data) => {
    ipcRenderer.send(channel, data);
    // console.log(addon.hello()); // 输出: Hello from C++!
  },
  recieve: (channel, func) => {
    ipcRenderer.on(channel, (e, ...args) => func(...args));
    // console.log(addon.hello()); // 输出: Hello from C++!
  },
});
